import { View, Image, Text, ITouchEvent } from "@tarojs/components";
import "./index.scss";
import StarsScore from "../../../components/StarsScore";

export interface ConsultantCardProps {
  cid: number,
  portrait: string,
  name: string,
  visited: string,
  score: number,
  state: string,
  onClick?: ((cid: number) => void),
}
// const ConsultantState = ['空闲', '忙碌'];
const ConsultantCard: React.FC<ConsultantCardProps> = ({ cid, portrait, name, visited, score, state, onClick }) => {
  return (<View className="consultant-card" onClick={() => onClick && onClick(cid)}>
    <Image className="consultant-card-portrait" src={portrait} />
    <View className="consult-card-name">{name}</View>
    {visited === '已咨询' && <View className="consult-card-visited">咨询过</View>}
    <Text className="consult-card-score-title">综合评价</Text>
    <View className="consult-card-score">
      <StarsScore score={score} starSize={48}></StarsScore>
    </View>
    <View className="consult-card-state" style={{ backgroundColor: `${state === '空闲' ? 'rgba(255,0,0,0.6)' : 'rgba(0,255,0,0.6)'}` }}>{state}</View>
  </View>)
}
export default ConsultantCard;
